#include<iostream>
#include"HttpServer.hpp"
#include"business.hpp"
#include"service.hpp"


int main(int argc,char* argv[])
{
    if(argc!=2)
    {
        cout<<"server server_port"<<endl;
        return 1;
    }
    Business b;
    //添加动态服务
    b.AddService("login",Login);
    b.AddService("register",Register);
    

    HttpServer hp(stoi(argv[1]));
    //注册函数
    hp.Registered([&b](const HttpRequest &requ, HttpResponse &resp)
    {
        b.Dispose(requ,resp);
    });

    hp.Start();

    hp.Stop();

    return 0;
}